package com.sanyue.codingsettlement.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sanyue.codingsettlement.model.dto.userteam.UserJoinTeamRequest;
import com.sanyue.codingsettlement.model.dto.userteam.UserTeamQueryRequest;
import com.sanyue.codingsettlement.model.entity.User;
import com.sanyue.codingsettlement.model.entity.UserTeam;

import javax.servlet.http.HttpServletRequest;

/**
 * 用户队伍关联表服务
 *
 * @author <a href="https://github.com/liyupi">程序员鱼皮</a>
 * @from <a href="https://www.code-nav.cn">编程导航学习圈</a>
 */
public interface UserTeamService extends IService<UserTeam> {

    /**
     * 校验数据
     *
     * @param userTeam
     * @param add 对创建的数据进行校验
     */
    void validUserTeam(UserTeam userTeam, boolean add);

    /**
     * 获取查询条件
     *
     * @param userTeamQueryRequest
     * @return
     */
    QueryWrapper<UserTeam> getQueryWrapper(UserTeamQueryRequest userTeamQueryRequest);

    /**
     * 用户加入队伍
     * @param userJoinTeamRequest
     * @param loginUser
     * @return
     */
    long userJoinTeam(UserJoinTeamRequest userJoinTeamRequest, User loginUser);

    /**
     * 用户退出队伍
     * @param teamId
     * @param loginUser
     * @return
     */
    boolean userExitTeam(long teamId, User loginUser);

    // /**
    //  * 获取用户队伍关联表封装
    //  *
    //  * @param userTeam
    //  * @param request
    //  * @return
    //  */
    // UserTeamVO getUserTeamVO(UserTeam userTeam, HttpServletRequest request);
    //
    // /**
    //  * 分页获取用户队伍关联表封装
    //  *
    //  * @param userTeamPage
    //  * @param request
    //  * @return
    //  */
    // Page<UserTeamVO> getUserTeamVOPage(Page<UserTeam> userTeamPage, HttpServletRequest request);
}
